#include "dht11.h"
#include "rtthread.h"

rt_uint8_t dht11_pin;
void dht11_init_pin(void)
{
   dht11_pin = rt_pin_get("PB.1");
   if(dht11_init(dht11_pin) == 0)
   {
       rt_kprintf("dht11 init ok\n");
   }
}

void get_temp_humi(rt_uint8_t *temp, rt_uint8_t *humi)
{
    rt_uint32_t val = dht11_get_temperature(dht11_pin);
    *temp = val & 0xff;
    *humi = (val >> 16) & 0xff;
}